<?php
require 'function.php';

date_default_timezone_set("PRC");

$_POST['time'] = date('y-m-d,H:i',time());

$db = require 'db.php';

$db[]=$_POST;

if(save($db)){
	$n = count($db);
	$result = array(
		'state'=>'success',
		'message'=>'发表成功',
		'count'=>$n,
		'data'=>$_POST,

	);
	echo json_encode($result);
}
else
{
	$result = array(
		'state'=>'error',
		'message'=>'发表失败'
	);
	echo json_encode($result);
}

?>